<?php

use think\facade\Route;

#base
Route::get('/', static function () {
    return json([
        'msg'  => 'welcome!',
        'code' => 0,
    ], 200);
});
Route::miss(static function () {
    return json([
        'msg'  => 'resource is not found！',
        'code' => -1,
    ], 404);
});


#test
Route::get('test', 'index/Test/test');
Route::get('serverUp', 'index/Test/serverUp');

Route::post('user/register', 'index/User/register');
Route::post('user/loginMpMini', 'index/User/loginMpMini');
//Route::post('user/loginMpMini/check', 'index/User/checkloginMpMini');
Route::get('user/info', 'index/User/getUserInfo');
Route::put('user/mpMiniPlatformInfo', 'index/User/putMpMiniPlatformInfo');
Route::get('user/myPage/info', 'index/User/getMyPageInfo');
Route::get('user/promoterPage/info', 'index/User/getPromoterPageInfo');
Route::get('user/list', 'index/User/getUserList');#
Route::post('user/repwd', 'index/User/repwd');    #重置密码


#banner
Route::group('banner', function () {
    Route::get('list', 'index/Banner/getBannerList');
});
#coupon
Route::group('coupon', function () {
    Route::get('issue/list', 'index/Coupon/getCouponIssueList');
    Route::post('issue', 'index/Coupon/postCouponIssue');
    Route::get('user/list', 'index/Coupon/getUserCouponList');
});
#product
Route::group('product', function () {
    Route::get('', 'index/Product/getProduct');
    Route::get('ids', 'index/Product/getProductByIds');
    Route::get('list', 'index/Product/getProductList');
    Route::get('category/list', 'index/Product/getProductCategoryList');
});
#cart
Route::group('cart', function () {
    Route::get('list', 'index/Cart/getCartList');
    Route::get('ids', 'index/Cart/getCartByIds');
    Route::post('', 'index/Cart/postCart');
    Route::put('', 'index/Cart/putCart');
    Route::delete('', 'index/Cart/deleteCart');
});

#address
Route::group('address', function () {
    Route::get('', 'index/Address/getAddress');
    Route::get('ids', 'index/Address/getAddressByIds');
    Route::get('list', 'index/Address/getAddressList');
    Route::post('', 'index/Address/postAddress');
    Route::put('', 'index/Address/putAddress');
    Route::delete('', 'index/Address/deleteAddress');
});

#order
Route::group('order', function () {
    Route::get('list', 'index/Order/getOrderList');
    Route::get('id', 'index/Order/getOrderById');
    Route::get('package', 'index/Order/getOrderPackage');
    Route::post('place', 'index/Order/postOrderPlace');
    Route::put('cancel', 'index/Order/putOrderCancel');
    Route::put('refund', 'index/Order/putOrderRefund');
    Route::put('refund/luru', 'index/Order/putOrderRefundLuru');
    Route::put('signFor', 'index/Order/putOrderSignFor');
});
#map
Route::group('map', function () {
    Route::get('list', 'index/Map/getMapList');
});

#packageCompany
Route::group('packageCompany', function () {
    Route::get('list', 'index/PackageCompany/getPackageCompanyList');
});


#notify
Route::group('notify', function () {
    Route::post('wxPay', 'index/Notify/wxPay');
    Route::post('wxRefund', 'index/Notify/wxRefund');
});

Route::group('media', function () {
    Route::post('upload/image', 'admin/Media/uploadImage');
});

Route::group('YYYYY', function () {
    Route::get('xxxxx/list', 'index/YYYYY/getXXXXXList');
    Route::post('xxxxx', 'index/YYYYY/postXXXXX');
    Route::put('xxxxx', 'index/YYYYY/putXXXXX');
    Route::delete('xxxxx', 'index/YYYYY/deleteXXXXX');
});

//->pattern(['woc_order_id' => '\d+']);